﻿using Chart3D;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FEM.Basic
{
    /// <summary>
    /// FEM_Model拓展方法
    /// </summary>
    public static class FEM_ModelExtension
    {
        /// <summary>
        /// 获得序列结果
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Chart3DMain GetChart3D(this FEM_Model model, Control control)
        {
            //初始化
            var chart3D = new Chart3DMain(control, isColorMap: false, type: AxisBoundType.Building);
            //设定透明度
            chart3D.DrawChart.SetColorMap(80);
            //获得节点字典
            var nodeDict = model.NodeDict;
            //是否黑色背景
            bool isBlack = control.BackColor == Color.Black;
            //遍历梁单元
            model.Beam_List.ForEach(beam => chart3D.Add(beam.GetData(nodeDict, isBlack)));
            //遍历柱单元
            model.Column_List.ForEach(column => chart3D.Add(column.GetData(nodeDict, isBlack)));
            //遍历墙单元
            model.Wall_List.ForEach(wall => chart3D.Add(wall.GetData(nodeDict, isBlack)));
            //返回列表
            return chart3D;
        }
    }
}
